package com.lhf.fvscore.result.advice;

import com.lhf.fvscommon.result.Result;
import com.lhf.fvscommon.result.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * <p></p>
 *
 * @author lhf
 * @since 2020/11/6 15:07
 */
@RestControllerAdvice
public class ExceptionAdvice {

    private final static Logger logger = LoggerFactory.getLogger(ExceptionAdvice.class);

    @ExceptionHandler(Exception.class)
    public Result<Object> exception(Exception e) {
        logger.error(e.getMessage());
        e.printStackTrace();
        return Result.failure(Status.FAILURE);
    }

}
